home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / bob_espo.swf / scripts / __Packages / MiniGames / JFS / JFSPatrick.as < prev   
Text File  |  2013-04-24  |  5KB  |  208 lines

  1. class MiniGames.JFS.JFSPatrick extends State
  2. {
  3.    static var sSTATE_IDLE = "Idle";
  4.    static var aSTATES_TAKEHOOK = ["Hook1","Hook2","Hook3","Hook4","Hook5","Hook6","Hook7","Hook8","Hook9","Hook10","Hook11"];
  5.    static var aSTATES_IDLEHOOK = ["IdleHook1","IdleHook2","IdleHook3","IdleHook4","IdleHook5","IdleHook6","IdleHook7","IdleHook8","IdleHook9","IdleHook10","IdleHook11"];
  6.    static var aSTATES_REEL = ["Reel1","Reel2","Reel3","Reel4","Reel5","Reel6","Reel7","Reel8","Reel9","Reel10","Reel11"];
  7.    static var nNB_FISHERROD_SOUNDS = 4;
  8.    static var nRANGE_DRAG = 50;
  9.    static var nFRAME_REACT_JELLY = 2;
  10.    static var nFRAME_DETACH_JELLY = 8;
  11.    static var nDRAG_TIME = 7;
  12.    function JFSPatrick(_mcRef)
  13.    {
  14.       super(_mcRef);
  15.       this.oJelly = null;
  16.       this.nX = 0;
  17.       this.nY = 0;
  18.       this.setState(MiniGames.JFS.JFSPatrick.sSTATE_IDLE);
  19.    }
  20.    function reel()
  21.    {
  22.       if(this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[0] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[1] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[2] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[3] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[4] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[5] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[6] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[7] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[8] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[9] || this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[10]))))))))))
  23.       {
  24.          this.setState(MiniGames.JFS.JFSPatrick.aSTATES_REEL[Number(this.oJelly.mcRef._name) - 1]);
  25.          Controller.getRef().getSounds().playRandomSound(MiniGames.JFS.JFSPatrick.nNB_FISHERROD_SOUNDS,"Reel",Controller.nSFX_VOLUME);
  26.       }
  27.    }
  28.    function takeHook(_oJelly)
  29.    {
  30.       if(this.sState == MiniGames.JFS.JFSPatrick.sSTATE_IDLE)
  31.       {
  32.          this.setState(MiniGames.JFS.JFSPatrick.aSTATES_TAKEHOOK[Number(_oJelly.mcRef._name) - 1]);
  33.          Controller.getRef().getSounds().playRandomSound(CTRLGame.nNB_THROW_SOUNDS,"IceBall_Throwed",Controller.nSFX_VOLUME);
  34.          this.oJelly = _oJelly;
  35.          this.oJelly.removeEvent();
  36.          this.nX = this.mcRef._xmouse;
  37.          this.nY = this.mcRef._ymouse;
  38.       }
  39.    }
  40.    function remove()
  41.    {
  42.       var _loc2_ = this.mcRef._xmouse - this.nX;
  43.       var _loc3_ = this.mcRef._ymouse - this.nY;
  44.       if(Math.abs(_loc2_) > MiniGames.JFS.JFSPatrick.nRANGE_DRAG || Math.abs(_loc3_) > MiniGames.JFS.JFSPatrick.nRANGE_DRAG)
  45.       {
  46.          this.reel();
  47.       }
  48.    }
  49.    function manageReel()
  50.    {
  51.       if(this.mcRef.mcState._currentframe == MiniGames.JFS.JFSPatrick.nFRAME_REACT_JELLY)
  52.       {
  53.          this.oJelly.react();
  54.       }
  55.       else if(this.mcRef.mcState._currentframe == MiniGames.JFS.JFSPatrick.nFRAME_DETACH_JELLY)
  56.       {
  57.          this.oJelly.leaveBus();
  58.          this.oJelly = null;
  59.       }
  60.       else if(this.stateFinished())
  61.       {
  62.          this.setState(MiniGames.JFS.JFSPatrick.sSTATE_IDLE);
  63.       }
  64.    }
  65.    function manageHook()
  66.    {
  67.       if(this.stateFinished())
  68.       {
  69.          this.setState(MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[Number(this.oJelly.mcRef._name) - 1]);
  70.       }
  71.    }
  72.    function Idle()
  73.    {
  74.    }
  75.    function Hook1()
  76.    {
  77.       this.manageHook();
  78.    }
  79.    function Hook2()
  80.    {
  81.       this.manageHook();
  82.    }
  83.    function Hook3()
  84.    {
  85.       this.manageHook();
  86.    }
  87.    function Hook4()
  88.    {
  89.       this.manageHook();
  90.    }
  91.    function Hook5()
  92.    {
  93.       this.manageHook();
  94.    }
  95.    function Hook6()
  96.    {
  97.       this.manageHook();
  98.    }
  99.    function Hook7()
  100.    {
  101.       this.manageHook();
  102.    }
  103.    function Hook8()
  104.    {
  105.       this.manageHook();
  106.    }
  107.    function Hook9()
  108.    {
  109.       this.manageHook();
  110.    }
  111.    function Hook10()
  112.    {
  113.       this.manageHook();
  114.    }
  115.    function Hook11()
  116.    {
  117.       this.manageHook();
  118.    }
  119.    function IdleHook1()
  120.    {
  121.       this.remove();
  122.    }
  123.    function IdleHook2()
  124.    {
  125.       this.remove();
  126.    }
  127.    function IdleHook3()
  128.    {
  129.       this.remove();
  130.    }
  131.    function IdleHook4()
  132.    {
  133.       this.remove();
  134.    }
  135.    function IdleHook5()
  136.    {
  137.       this.remove();
  138.    }
  139.    function IdleHook6()
  140.    {
  141.       this.remove();
  142.    }
  143.    function IdleHook7()
  144.    {
  145.       this.remove();
  146.    }
  147.    function IdleHook8()
  148.    {
  149.       this.remove();
  150.    }
  151.    function IdleHook9()
  152.    {
  153.       this.remove();
  154.    }
  155.    function IdleHook10()
  156.    {
  157.       this.remove();
  158.    }
  159.    function IdleHook11()
  160.    {
  161.       this.remove();
  162.    }
  163.    function Reel1()
  164.    {
  165.       this.manageReel();
  166.    }
  167.    function Reel2()
  168.    {
  169.       this.manageReel();
  170.    }
  171.    function Reel3()
  172.    {
  173.       this.manageReel();
  174.    }
  175.    function Reel4()
  176.    {
  177.       this.manageReel();
  178.    }
  179.    function Reel5()
  180.    {
  181.       this.manageReel();
  182.    }
  183.    function Reel6()
  184.    {
  185.       this.manageReel();
  186.    }
  187.    function Reel7()
  188.    {
  189.       this.manageReel();
  190.    }
  191.    function Reel8()
  192.    {
  193.       this.manageReel();
  194.    }
  195.    function Reel9()
  196.    {
  197.       this.manageReel();
  198.    }
  199.    function Reel10()
  200.    {
  201.       this.manageReel();
  202.    }
  203.    function Reel11()
  204.    {
  205.       this.manageReel();
  206.    }
  207. }
  208.